package io.sage.modules.query.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.sage.modules.goods.service.BGoodsService;
import io.sage.modules.outwarehouse.service.BEmployeeAccessRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.sage.common.utils.PageUtils;
import io.sage.common.utils.R;
import io.sage.modules.query.service.QueryService;
import io.swagger.annotations.Api;

@RestController
@RequestMapping("main")
@Api(tags = "综合查询")
public class QueryController {

    @Autowired
    private BGoodsService goodsService;

    @Autowired
    private BEmployeeAccessRecordService employeaccessRecordService;

    /**
     * 首页查询
     *
     * @param
     * @return
     */
    @GetMapping(value = "/index")
    @ResponseBody
    public R queryAll() {
        List list = new ArrayList<Integer>();
        Map<String, Object> params = new HashMap<>();
        Integer count = goodsService.selectNewCount(params);
        list.add(count);
        params.put("isUpshelf", 1);
        count = goodsService.selectNewCount(params);
        list.add(count);
        params = new HashMap<>();
        params.put("remark", 1);
        count = employeaccessRecordService.selectNewCount(params);
        list.add(count);
        params.put("remark", 2);
        count = employeaccessRecordService.selectNewCount(params);
        list.add(count);
        return R.ok().put("list", list);
    }


}
